AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )

function ENT:SpawnFunction( id, tr )

	local trace = util.GetPlayerTrace( id, id:GetAimVector() )
	local tr = util.TraceLine( trace )
	
	local radio = ents.Create( "ts2_radio" )
	radio:SetPos( tr.HitPos + tr.HitNormal * 30 )
	radio:Spawn()
	radio:Activate()

end

function ENT:Initialize()

	self.Entity:SetModel( "models/props_lab/citizenradio.mdl" )
	
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )
	
	self.Entity:SetNWInt( "radiof", 0 );
	
end

function ENT:Use( a, c )

	self.Entity:SetUseType( 3 )
	self.Entity:SetNWInt( "radiof", self.Entity:GetNWInt( "radiof" ) + 1 );	

	print( self.Entity:GetNWInt( "radiof" ) )
	
end
	
	
function ENT:Think()

	if( self.Entity:GetNWInt( "radiof" ) > 999 ) then
	
		self.Entity:SetNWInt( "radiof", 0 )
		
	end

end	
		
		